<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta content="no-cache" http-equiv="Pragma"/>
    <meta   http-equiv= "Cache-Control"   content= "no-cache" />
    <meta   http-equiv= "Expires"   content= "0" />
    <meta charset="UTF-8">
    <title>添加</title>
    <style>
        .required:before{
            content: '*';
            color: red;
        }
    </style>
</head>
<body>
<form class="col-sm-12" id="add-form">
    <div>
        <label class="col-sm-4">姓名：</label>
        <!-- autocomplete="new-password"    禁止浏览器保存的信息弹框-->
        <input class="col-sm-8 " type="text" name="name" autocomplete="new-password" required>
    </div>
    <div>
        <label class="col-sm-4">电话：</label>
        <input class="col-sm-8" name="phone" type="text" autocomplete="new-password">
    </div>
    <div>
        <label class="col-sm-4">地址：</label>
        <input class="col-sm-8" name="address" type="text" autocomplete="new-password">
    </div>
    <div>
        <label class="col-sm-4">生日：</label>
        <input class="col-sm-8" name="birthday" type="date" autocomplete="new-password" required>
    </div>
</form>
<!--<input type='button' class='btn-primary' onclick='add()' value='确定'>-->
</body>
<script th:src="@{/static/js/libs/jquery.js}" type="text/javascript"></script>
<script th:src="@{/static/js/libs/jquery.validate.min.js}" type="text/javascript"></script>
<script th:src="@{/static/js/libs/jquery.validate.extend.js}" type="text/javascript"></script>
<script>
    function submit() {
        if ($.validate.form()){
            var data = $("#add-form").serialize()
            $.post("/user/add",data,function (data) {
                var index = parent.layer.getFrameIndex(window.name)//获取当前iframe层索引
                parent.layer.close(index)//关闭
            })
        }
    }
</script>
</html>
